dynamic class com.gskinner.utils.SWFBridgeAS2
{
    var _connected: Boolean = false;
    var baseID;
    var clientObj;
    var dispatchEvent;
    var extID;
    var host;
    var lc;
    var myID;

    function SWFBridgeAS2(p_id, p_clientObj)
    {
        mx.events.EventDispatcher.initialize(this);
        this.baseID = p_id.split(":").join("");
        this.lc = new LocalConnection();
        var _this = this;
        this.lc.com_gskinner_utils_SWFBridge_init = function ()
        {
            _this.com_gskinner_utils_SWFBridge_init();
        }
        ;
        this.lc.com_gskinner_utils_SWFBridge_receive = function ()
        {
            _this.com_gskinner_utils_SWFBridge_receive.apply(_this, arguments);
        }
        ;
        this.clientObj = p_clientObj;
        this.host = this.lc.connect(this.baseID + "_host");
        this.myID = this.baseID + (this.host ? "_host" : "_guest");
        this.extID = this.baseID + (this.host ? "_guest" : "_host");
        if (this.host) 
        {
            return;
        }
        this.lc.connect(this.myID);
        this.lc.send(this.extID, "com_gskinner_utils_SWFBridge_init");
    }

    function close()
    {
        this.lc.close();
        delete this.clientObj;
        delete this.lc;
        this._connected = false;
    }

    function send()
    {
        if (this._connected) 
        {
            var __reg3 = arguments.slice(0);
            __reg3.unshift("com_gskinner_utils_SWFBridge_receive");
            __reg3.unshift(this.extID);
            this.lc.send.apply(this.lc, __reg3);
        }
    }

    function get id()
    {
        return this.baseID;
    }

    function get connected()
    {
        return this._connected;
    }

    function com_gskinner_utils_SWFBridge_receive()
    {
        var __reg3 = arguments.slice(0);
        var __reg4 = String(__reg3.shift());
        this.clientObj[__reg4].apply(this.clientObj, __reg3);
    }

    function com_gskinner_utils_SWFBridge_init()
    {
        if (this.host) 
        {
            this.lc.send(this.extID, "com_gskinner_utils_SWFBridge_init");
        }
        this._connected = true;
        this.dispatchEvent({type: "connect"});
    }

}
